﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Parser.SyntaxTree.RazorError
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Globalization;
using System.Web.Razor.Text;

namespace System.Web.Razor.Parser.SyntaxTree
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Represents a parsing error in Razor.</summary>
  public class RazorError : IEquatable<RazorError>
  {
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Initializes a new instance of the <see cref="T:System.Web.Razor.Parser.SyntaxTree.RazorError" /> class.</summary>
    /// <param name="message">The error message.</param>
    /// <param name="location">The source location of the error.</param>
    public RazorError(string message, SourceLocation location)
      : this(message, location, 1)
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Initializes a new instance of the <see cref="T:System.Web.Razor.Parser.SyntaxTree.RazorError" /> class.</summary>
    /// <param name="message">The error message.</param>
    /// <param name="absoluteIndex">The absolute index of the source location.</param>
    /// <param name="lineIndex">The line index of the source location.</param>
    /// <param name="columnIndex">The column index of the source location.</param>
    public RazorError(string message, int absoluteIndex, int lineIndex, int columnIndex)
      : this(message, new SourceLocation(absoluteIndex, lineIndex, columnIndex))
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Initializes a new instance of the <see cref="T:System.Web.Razor.Parser.SyntaxTree.RazorError" /> class.</summary>
    /// <param name="message">The error message.</param>
    /// <param name="location">The source location of the error.</param>
    /// <param name="length">The length for the error.</param>
    public RazorError(string message, SourceLocation location, int length)
    {
      this.Message = message;
      this.Location = location;
      this.Length = length;
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Initializes a new instance of the <see cref="T:System.Web.Razor.Parser.SyntaxTree.RazorError" /> class.</summary>
    /// <param name="message">The error message.</param>
    /// <param name="absoluteIndex">The absolute index of the source location.</param>
    /// <param name="lineIndex">The line index of the source location.</param>
    /// <param name="columnIndex">The column index of the source location.</param>
    /// <param name="length">The length for the error.</param>
    public RazorError(
      string message,
      int absoluteIndex,
      int lineIndex,
      int columnIndex,
      int length)
      : this(message, new SourceLocation(absoluteIndex, lineIndex, columnIndex), length)
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Gets or sets the error message.</summary>
    /// <returns>The error message.</returns>
    public string Message { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Gets the source location of the error.</summary>
    /// <returns>The source location of the error.</returns>
    public SourceLocation Location { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Gets or sets the length for the error.</summary>
    /// <returns>The length for the error.</returns>
    public int Length { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Returns the string representation of this error instance.</summary>
    /// <returns>The string representation of this error instance.</returns>
    public override string ToString() => string.Format((IFormatProvider) CultureInfo.CurrentCulture, "Error @ {0}({2}) - [{1}]", (object) this.Location, (object) this.Message, (object) this.Length);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Determines whether the specified object is equal to this instance.</summary>
    /// <returns>true if the specified object is equal to this instance; otherwise, false.</returns>
    /// <param name="obj">The object to compare to this instance.</param>
    public override bool Equals(object obj) => obj is RazorError other && this.Equals(other);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Returns the hash code for the current instance.</summary>
    /// <returns>The hash code for the current instance.</returns>
    public override int GetHashCode() => base.GetHashCode();

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. Determines whether the specified object is equal to this instance.</summary>
    /// <returns>true if the specified object is equal to this instance; otherwise, false.</returns>
    /// <param name="other">The object to compare to this instance.</param>
    public bool Equals(RazorError other) => string.Equals(other.Message, this.Message, StringComparison.Ordinal) && this.Location.Equals(other.Location);
  }
}
